package com.jufanshare.myblog.common.dto;

/**
 * 返回json对象
 */
public class AjaxRes {
    private boolean res;
    private int resNum;
    private String resTxt;
    private Object obj;
    public AjaxRes() {
    }
    public AjaxRes(boolean res, int resNum, String resTxt, Object obj) {
        this.res = res;
        this.resNum = resNum;
        this.resTxt = resTxt;
        this.obj = obj;
    }
    public AjaxRes(boolean res) {
        this.res = res;
    }
    public AjaxRes(int resNum) {
        this.resNum = resNum;
    }
    public AjaxRes(String resTxt) {
        this.resTxt = resTxt;
    }
    public AjaxRes(Object obj) {
        this.obj = obj;
    }
    public AjaxRes(boolean res, int resNum, String resTxt) {
        this.res = res;
        this.resNum = resNum;
        this.resTxt = resTxt;
    }
    public void setFailMsg(String resTxt){
        this.res=false;
        this.resNum=0;
        this.resTxt=resTxt;
    }
    public void setFailMsg(String resTxt,int resNum){
        this.res=false;
        this.resNum=resNum;
        this.resTxt=resTxt;
    }
    public void setSuccess(Object obj){
        this.obj=obj;
        this.res=true;
    }
    public void setSuccess(Object obj,String resTxt){
        this.obj=obj;
        this.res=true;
        this.resTxt=resTxt;
    }

    public boolean isRes() {
        return res;
    }

    public int getResNum() {
        return resNum;
    }

    public String getResTxt() {
        return resTxt;
    }

    public Object getObj() {
        return obj;
    }

    public void setRes(boolean res) {
        this.res = res;
    }

    public void setResNum(int resNum) {
        this.resNum = resNum;
    }

    public void setResTxt(String resTxt) {
        this.resTxt = resTxt;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    @Override
    public String toString() {
        return "AjaxRes{" +
                "res=" + res +
                ", resNum=" + resNum +
                ", resTxt='" + resTxt + '\'' +
                ", obj=" + obj +
                '}';
    }
}
